﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using ZSZ.Service;
using ZSZ.Service.Entity;

namespace ZSZ.TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            //using (ZSZDBcontext zs = new ZSZDBcontext())
            //{

            //    UserService s = new UserService();
            //    s.AddNew("18706374813","1293348224");
            //    Console.WriteLine("ok");
            //    Console.ReadKey();
            //}
            string result = string.Empty;
            try
            {
                HttpWebRequest wbRequest = (HttpWebRequest)WebRequest.Create("https://api.jisuapi.com/sms/send");
                wbRequest.Method = "POST";
                wbRequest.ContentType = "application/x-www-form-urlencoded";   //如果要发送Json数据就是application/json
                string form = "mobile=17863483550&content=您的注册验证码为：6666,请不要将验证码给任何人【美斯坦福】&appkey=ba49d2e8f2df9d8c";                                            //如果要发送Json数据就是{a:15,g:24}格式
                using (Stream requestStream = wbRequest.GetRequestStream())
                {
                    using (StreamWriter swrite = new StreamWriter(requestStream))
                    {
                        swrite.Write(form);
                    }
                }
                HttpWebResponse wbResponse = (HttpWebResponse)wbRequest.GetResponse();
                using (Stream responseStream = wbResponse.GetResponseStream())
                {
                    using (StreamReader sread = new StreamReader(responseStream))
                    {
                        result = sread.ReadToEnd();
                    }
                }
            }
            catch (Exception ex)
            { }
            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}
